<template>
  <div id="">
    <Son :dataList="list" @pushobj="getObj" ref="son"></Son>
  </div>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue'
import Son from './Son/index.vue'

// 可以通过给子组件绑定ref拿到它的值
const son = ref(null)

const list = reactive<Number[]>([1, 2, 3])

// 通过子组件的自定义事件触达父组件的方法并把值作为参数传入
const getObj = (data: Object, num: number) => {
  console.log(data, num);
  console.log(son.value);
}

</script>

<style lang="less">
</style>
